package com.xm.servlet.background.menu;

import com.xm.entity.Menu;
import com.xm.service.background.MenuService;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 *  菜单Servlet
 *  @author 陈盼
 *  @date 2023-12-26 下午 04:01
 */
@WebServlet("/background/get/menu")
public class GetMenuServlet extends HttpServlet {
    private final MenuService service = new MenuService();

    @SneakyThrows(Exception.class)
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)  {
        resp.setContentType("text/html;charset=utf-8");
        List<Menu> menuList = service.getAll();
        req.setAttribute("menuList",menuList);
    }
}
